package controllayer;

import java.util.ArrayList;

import modellayer.PartSale;
import modellayer.Sale;
import modellayer.Item;
import dblayer.DBPartSale;
import dblayer.IFDBPartSale;

public class CtrPartSale {

	private IFDBPartSale dbObj;
	
	public CtrPartSale(){
		dbObj = new DBPartSale();
	}
	
	public ArrayList<PartSale> getAllPartSales(){
		return dbObj.getAllPartSale();
	}
	
	public PartSale searchByID(int id){
		return dbObj.searchByID(id);
	}
	
	public ArrayList<PartSale> searchBySaleID(int id){
		return dbObj.searchBySaleID(id);
	}
	
	//
	
	public int createPartSale(int id, int amount, Sale sale, Item item){
		PartSale partS = new PartSale(id, amount, sale, item);
		
		return dbObj.updatePartSale(partS);
	}
	
	public int deletePartSale(int id){
		return dbObj.deletePartSale(id);
	}
}
